package net.jielan188.hd.service.queue;

import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

/**
 * 消息接收器
 * Created by hgg on 2017-01-24.
 */
@Component
public class QueueReceiver implements MessageListener {

    /**
     * 接收文本消息类
     * @param message
     */
    @Override
    public void onMessage( Message message ) {
        try {
            System.out.println( "QueueReceiver1接收到消息:"+((TextMessage)message).getText() );
        } catch ( JMSException e ) {
            e.printStackTrace();
        }
    }
}
